package com.csun.cmny.provider.model.enums.follow;

import java.util.Arrays;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-02-15 21:53
 * @Description:
 */
public enum FollowHeartStatustEnum {

    /**
     * 心率值异常低
     */
    HEART_LOW_MORE("心率值异常低", "请检查测量方式", 0, 45),

    /**
     * 心动过缓
     */
    HEART_LOW("心动过缓", "请就医检查", 45, 55),

    /**
     * 理想心率
     */
    HEART_PERFECT("理想心率", "请保持运动 良好生活习惯 心态平和", 55, 70),

    /**
     * 正常心率
     */
    HEART_NORMAL("正常心率", "请保持运动 良好生活习惯 心态平和", 70, 100),

    /**
     * 心动过速
     */
    HEART_HIGH("心动过速", "请就医检查", 100, 160),

    /**
     * 心率值异常高
     */
    HEART_HIGH_MORE("心率值异常高", "请检查测量方式", 160, 300),;

    String status;

    String suggest;

    Integer heartLow;

    Integer heartHigh;

    FollowHeartStatustEnum(String status, String suggest, Integer heartLow, Integer heartHigh) {
        this.status = status;
        this.suggest = suggest;
        this.heartLow = heartLow;
        this.heartHigh = heartHigh;
    }

    /**
     * Gets status.
     *
     * @return  the status
     */
    public String getStatus() {
        return status;
    }

    /**
     * Gets suggest.
     *
     * @return  the suggest
     */
    public String getSuggest() {
        return suggest;
    }

    /**
     * 获取状态
     */
    public static String getStatus(Integer heart) {

        for (FollowHeartStatustEnum ele : FollowHeartStatustEnum.values()) {
            if (heart.compareTo(ele.heartLow) >=0 && heart.compareTo(ele.heartHigh) < 0) {
                return ele.getStatus();
            }
        }
        return null;
    }

    /**
     * 获取建议
     */
    public static String getSuggest(Integer heart) {

        for (FollowHeartStatustEnum ele : FollowHeartStatustEnum.values()) {
            if (heart.compareTo(ele.heartLow) >=0 && heart.compareTo(ele.heartHigh) < 0) {
                return ele.getSuggest();
            }
        }
        return null;
    }

    /**
     * 获取List集合
     *
     * @return List list
     */
    public static List<FollowHeartStatustEnum> getList() {
        return Arrays.asList(FollowHeartStatustEnum.values());
    }

}
